import Flutter
import UIKit


public class SwiftLivepluginPlugin: NSObject, FlutterPlugin {
    
    var factory: WYYXLiveViewFactory
    
    public init(with registrar: FlutterPluginRegistrar) {
      self.factory = WYYXLiveViewFactory(withRegistrar: registrar)
      registrar.register(factory, withId: "com.sunstar.liveplugin.view")
        
        LiveEventChannelSupport.register(with: registrar)
    }
    
    
  public static func register(with registrar: FlutterPluginRegistrar) {
    
    registrar.addApplicationDelegate(SwiftLivepluginPlugin(with: registrar))
    
    
    //初始化管理类
 //   WYYXLiveManager.sharedInstance.initMediaCapture(url: "");
//    let channel = FlutterMethodChannel(name: "liveplugin", binaryMessenger: registrar.messenger())
//    let instance = SwiftLivepluginPlugin(with: registrar)
//    registrar.addMethodCallDelegate(instance, channel: channel)
  }

  public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
    
    result("iOS " + UIDevice.current.systemVersion)
  }
}
